package com.zuxia.impservices;

import java.util.Date;
import java.util.List;

import com.zuxia.iDao.PositioninfoDAOI;
import com.zuxia.iDao.RecruitinfoDAOI;
import com.zuxia.iDao.RecruitrecordinfoDAOI;
import com.zuxia.iservices.RecruitmentManagementServicesI;
import com.zuxia.po.Positioninfo;
import com.zuxia.po.Recruitinfo;
import com.zuxia.po.Recruitrecordinfo;
import com.zuxia.util.PageModel;

public class RecruitmentManagementServices implements RecruitmentManagementServicesI{
	public RecruitinfoDAOI recruitinfoDAO;
	public PositioninfoDAOI positioninfoDAO;
	public RecruitrecordinfoDAOI recruitrecordinfoDAO;

	

	//查询一个Recruitinfo对象
	public Recruitinfo riidShowRecruitinfo(int riid)
	{
		return recruitinfoDAO.riidShowRecruitinfo(riid);
	}
	
	//删除指定需求
	public Boolean deleteRecruitinfo(int riid)
	{
		Boolean b=false;
		System.out.println("删除需求！");
		b=recruitinfoDAO.deleteRecruitinfo(riid);
		return b;
	}
	
	public List showRecruitinfo(String ptIname) {
		// TODO Auto-generated method stub
		//查询的职位需求
		System.out.println("我将要查询所有职位");
		List list = recruitinfoDAO.showRecruitinfo(ptIname);
		System.out.println("将要返回结果");
		return list;
	}
	
	public List showPositioninfo() {
		// TODO Auto-generated method stub
		//查询所有的职位
		System.out.println("我将要查询所有职位");
		List list = positioninfoDAO.showPositioninfo();
		System.out.println("将要返回结果");
		return list;
	}
	
	public Boolean addrecruitinfo(Recruitinfo recruitinfo,Positioninfo positioninfo) {
		// TODO Auto-generated method stub
		Boolean b=false;
		System.out.println("发布需求！");
		
			b=recruitinfoDAO.add(recruitinfo);
		
		return b;
	}
	
	//查询某个职位需求是否已经存在
	public Boolean ptIidShowRecruitinfo(int ptIid) {
		// TODO Auto-generated method stub
		//根据id查询寻相应职位
		System.out.println("我将要判断职位需求是否已存在");
		Boolean p=recruitinfoDAO.ptIidShowRecruitinfo(ptIid);
		System.out.println("将要返回结果");
		return p;
	}
	
	//查询某个职位对象
	public Positioninfo positioninfoFindById(int ptIid) {
		// TODO Auto-generated method stub
		//根据id查询寻相应职位
		System.out.println("我将要查询职位");
		Positioninfo p=positioninfoDAO.findById(ptIid);
		System.out.println("将要返回结果");
		return p;
	}
	
	public Positioninfo idshow(int ptIid) {
		// TODO Auto-generated method stub
		//根据id查询寻相应职位
		System.out.println("我将要查询职位");
		Positioninfo p=positioninfoDAO.showIdPositioninfo(ptIid);
		System.out.println("将要返回结果");
		return p;
	}
	
	public RecruitinfoDAOI getRecruitinfoDAO() {
		return recruitinfoDAO;
	}

	public void setRecruitinfoDAO(RecruitinfoDAOI recruitinfoDAO) {
		this.recruitinfoDAO = recruitinfoDAO;
	}

	public PositioninfoDAOI getPositioninfoDAO() {
		return positioninfoDAO;
	}

	public void setPositioninfoDAO(PositioninfoDAOI positioninfoDAO) {
		this.positioninfoDAO = positioninfoDAO;
	}

	
	
	public RecruitrecordinfoDAOI getRecruitrecordinfoDAO() {
		return recruitrecordinfoDAO;
	}

	public void setRecruitrecordinfoDAO(RecruitrecordinfoDAOI recruitrecordinfoDAO) {
		this.recruitrecordinfoDAO = recruitrecordinfoDAO;
	}

	public List showPositionOnlyIdAndName() {
		// TODO Auto-generated method stub
		return null;
	}

	//修改需求
	public Boolean updateRecruitinfo(int riid, String riaddress, int riicount,
			Date riiendTime, String rirequirement) {
		// TODO Auto-generated method stub
		return recruitinfoDAO.updateRecruitinfo(riid,riaddress,riicount,riiendTime,rirequirement);
	}

	public PageModel<Recruitinfo> showRecruitinfo(String ptIname,
			int pageNumber, int limit) {
		// TODO Auto-generated method stub
		return recruitinfoDAO.showRecruitinfo(ptIname,pageNumber,limit);
	}
	
	//前台查询
	public List<Recruitinfo> showRecruitinfo() {
		// TODO Auto-generated method stub
		return recruitinfoDAO.showRecruitinfo(null);
	}
	
	//添加应聘记录
	public Boolean addRecruitrecordinfo(Recruitrecordinfo recruitrecordinfo,
			int ptIid) {
		// TODO Auto-generated method stub
		//获取对象
		Positioninfo p=positioninfoDAO.findById(ptIid);
		recruitrecordinfo.setPositioninfo(p);
		recruitrecordinfo.setRritime(new Date());
		return recruitrecordinfoDAO.addRecruitrecordinfo(recruitrecordinfo);
	}

	public Boolean addShowRecruitrecordinfo(
			Recruitrecordinfo recruitrecordinfo, int ptIid) {
		// TODO Auto-generated method stub
		//获取对象
		Positioninfo p=positioninfoDAO.findById(ptIid);
		recruitrecordinfo.setPositioninfo(p);
		return recruitrecordinfoDAO.addShowRecruitrecordinfo(recruitrecordinfo);
	}

	public PageModel<Recruitrecordinfo> showRecruitrecordinfo(int ptIid,
			int pageNumber, int limit,String order) {
		// TODO Auto-generated method stub
		return recruitrecordinfoDAO.showRecruitrecordinfo(ptIid,pageNumber,limit,order);
	}

	public Boolean deleteRecruitrecordinfo(int rrid) {
		// TODO Auto-generated method stub
		return recruitrecordinfoDAO.deleteRecruitrecordinfo(rrid);
	}
	
}